package service;

import dao.Stu_CurriculumDAO;
import domain.Stu_Curriculum;

import java.util.List;

/**
 * @author 杨森
 * @date 2022年11月28日 20:13
 */
public class Stu_CurriculumService {
    Stu_CurriculumDAO stu_Cur=new Stu_CurriculumDAO();

    //插入学生
    public boolean insert_Stu(int id, String name, int s_id, String s_name){
        int update= stu_Cur.update("insert into stu_curriculum values(?,?,?,?,?,?)",null,id,name,s_id,s_name,null);
        if (update <= 0) {
            return false;
        }
        return true;
    }

    //修改根据学生的id修改学生的分数
    public boolean updateScore(int  score, int c_id){
        int update = stu_Cur.update("update stu_curriculum set score=? where course_id=?;", score,c_id );

        if (update <= 0) {
            return false;
        }
        return true;
    }

    //查询学生的分数
    public List<Stu_Curriculum> scoreList(String name) {
        return stu_Cur.queryMulti("select * from stu_curriculum where course_selected_stu=?",Stu_Curriculum.class,name);

    }



}
